package cn.tedu.knows.portal.controller;


import cn.tedu.knows.portal.service.IUserService;
import cn.tedu.knows.portal.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tedu.cn
 * @since 2022-03-04
 */
@RestController
@RequestMapping("/v1/users")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/me")
    public UserVO me(
            @AuthenticationPrincipal UserDetails user
            ){
        UserVO userVO=userService.getUserVO(user.getUsername());
        return userVO;
    }





}
